package com.example.demo.lab2.service.impl;


import com.example.demo.lab2.entity.EmpWithDep;
import com.example.demo.lab2.entity.Employees;
import com.example.demo.lab2.mapper.EmployeesMapper;
import com.example.demo.lab2.service.EmployeesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;


@Service
public class EmployeesServiceImpl implements EmployeesService {
    @Autowired
    private EmployeesMapper employeesMapper;

    @Override
    public int insert(Employees employee) {
        int insert = employeesMapper.insert(employee);
        return insert;
    }

    @Override
    public int delete(BigDecimal id) {
        return employeesMapper.delete(id);
    }

    @Override
    public int update(Employees employee) {
        return employeesMapper.update(employee);
    }

    @Override
    public List<Employees> list() {
        List<Employees> employeesList = employeesMapper.list();
        return employeesList;
    }

    @Override
    public List<EmpWithDep> listWithDep() {
        List<EmpWithDep> empWithDeps = employeesMapper.listWithDep();
        return empWithDeps;

    }
}
